package com.classeven.downhill.element;

import org.andengine.entity.text.Text;
import org.andengine.opengl.font.StrokeFont;
import org.andengine.opengl.texture.ITexture;
import org.andengine.opengl.texture.TextureOptions;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.andengine.util.color.Color;

import android.graphics.Typeface;

import com.classeven.downhill.engine.GameEngine;

public class AStrokeText 
{
	GameEngine engine;
	StrokeFont strokeFont;
	Text text;
	
	public AStrokeText(GameEngine engine,  String path, float size, Color color, float sizeStroke, Color colorStroke, String textStroke)
	{
		this.engine = engine;
		load( path, size, color, sizeStroke, colorStroke, textStroke);
	
	}

	private void load(final String path, float size, Color color, float sizeStroke, Color colorStroke, String textStroke) 
	{
		final ITexture strokeFontTexture = new BitmapTextureAtlas(engine.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
		
		strokeFont = new StrokeFont(engine.getFontManager(), strokeFontTexture, Typeface.create(Typeface.DEFAULT, Typeface.NORMAL), size, true, color, 2, colorStroke);
		strokeFont.load();

		text =  new Text(0, 0, strokeFont, textStroke, engine.getVertexBufferObjectManager());	
	}
	
	public void setPos(float X, float Y)
	{
		text.setPosition(X, Y);
	}
	
	public Text theText()
	{
		return text;
	}
		
	
}
